﻿/**
 * Created by lenovo on 2018/2/26.
 */


$(function () {
    var p = $("#mobile").val(); //getUrlParam("fid");
    if (p != null && p != "" && p != "undefined")
        sessionStorage.setItem("userPhone", p);

    submit();
    toVolume();
    toArea();
    volumeFrame();
    ruleFrame();
});
//提交
function submit() {
    $(".submit-btn").click(function () {
        var val = $(".phone-number").val();
        console.log(val);
    })
}
//去各种体验馆
function toArea() {
    $(".free img").click(function () {
        window.location.href = "/Home/FreeShop";
    });
    $(".years img").click(function () {
        window.location.href = "/Home/YearsShop"
    });
    $(".current img").click(function () {
        window.location.href = "/Home/CurrentShop"
    })
}
var ModalHelper = (function (bodyCls) {
    var scrollTop;
    return {
        afterOpen: function () {
            scrollTop = document.scrollingElement.scrollTop;
            document.body.classList.add(bodyCls);
            document.body.style.top = -scrollTop + 'px';
        },
        beforeClose: function () {
            document.body.classList.remove(bodyCls);
            // scrollTop lost after set position:fixed, restore it back.
            document.scrollingElement.scrollTop = scrollTop;
        }
    };
})('modal-open');
//弹出体验卷
function toVolume() {
    $(".my-btn").click(function () {
        $(".volume").animate({ bottom: '0' });
        ModalHelper.afterOpen();
    });
    $(".volume .close-img").click(function () {
        $(".volume").animate({ bottom: '-100%' })

        ModalHelper.beforeClose();
    })
}
//体验券详情弹出
function volumeFrame() {
    $(".volume .volume-list").click(function () {
        $(".volume-frame").show();
        ModalHelper.afterOpen();

    });
    $(".volume-frame .close-img").click(function () {
        $(".volume-frame").hide();
        ModalHelper.beforeClose();
    });
}
//活动规则弹出
function ruleFrame() {
    $(".ins-rule .rule-icon").click(function () {
        $(".rule-frame").show();
        ModalHelper.afterOpen();
    });
    $(".rule-frame .close-img").click(function () {
        $(".rule-frame").hide();
        //$("body,html").css({
        //    "height": "auto",
        //    "overflow": "auto"
        //})
        ModalHelper.beforeClose();
    })
}